From 7f6331edab97a85e3ce722a5e3442b849db4891f Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 18 Mar 2010 11:02:25 +0000 Subject: [PATCH] x86: fix dom0 S3 when x2apic is used. 1) Some variables and functions in xen/arch/x86/genapic/x2apic.c should not be marked with __init* as they will be used during s3 resume; 2) In do_suspend_lowlevel -> restore_rest_processor_state -> mcheck_init, lapic is accessed, but x2apic hasn't been re-enabled yet (x2apic is re-enabled() in device_power_up -> lapic_resume). The patch moves mcheck_init to a later place. Signed-off-by: Dexuan Cui --- xen/arch/x86/acpi/power.c | 2 ++ xen/arch/x86/acpi/suspend.c | 1 - xen/arch/x86/genapic/x2apic.c | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index 25d92e1527..dfe35468ac 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -207,6 +207,8 @@ static int enter_state(u32 state) device_power_up(); + mcheck_init(&boot_cpu_data); + printk(XENLOG_INFO "Finishing wakeup from ACPI S%d state.\n", state); if ( (state == ACPI_STATE_S3) && error ) diff --git a/xen/arch/x86/acpi/suspend.c b/xen/arch/x86/acpi/suspend.c index 7735e3a6fb..ddddbc8921 100644 --- a/xen/arch/x86/acpi/suspend.c +++ b/xen/arch/x86/acpi/suspend.c @@ -82,5 +82,4 @@ void restore_rest_processor_state(void) wrmsrl(MSR_IA32_CR_PAT, host_pat); mtrr_bp_restore(); - mcheck_init(&boot_cpu_data); } diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c index 610db8baa0..2cb7835060 100644 --- a/xen/arch/x86/genapic/x2apic.c +++ b/xen/arch/x86/genapic/x2apic.c @@ -23,19 +23,19 @@ #include #include -static int __initdata x2apic = 1; +static int x2apic = 1; boolean_param("x2apic", x2apic); -static int __initdata x2apic_phys; /* By default we use logical cluster mode. */ +static int x2apic_phys; /* By default we use logical cluster mode. */ boolean_param("x2apic_phys", x2apic_phys); -static int __init probe_x2apic_phys(void) +static int probe_x2apic_phys(void) { return x2apic && x2apic_phys && x2apic_is_available() && iommu_supports_eim(); } -static int __init probe_x2apic_cluster(void) +static int probe_x2apic_cluster(void) { return x2apic && !x2apic_phys && x2apic_is_available() && iommu_supports_eim(); -- 2.30.2